package com.itheima.design.mode.strategy.service;

import com.itheima.design.mode.strategy.entity.Order;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceV2 {

    public Order prepareOrder(Order order, String promotion) {

        switch (promotion){
            case "p1":
                return calPromotion1(order);
            case "p2":
                return calPromotion2(order);
            case "p3":
                return calPromotion3(order);
            case "p4":
                return calPromotion4(order);
        }

        return order;
    }


    private Order calPromotion1(Order order){
        System.out.println("v2 这是促销方法1");
        return order;
    }

    private Order calPromotion2(Order order){
        System.out.println("v2 这是促销方法2");
        return order;
    }

    private Order calPromotion3(Order order){
        System.out.println("v2 这是促销方法3");
        return order;
    }

    private Order calPromotion4(Order order){
        System.out.println("v2 这是促销方法4");
        return order;
    }

}
